Loops
Loop nodes allow a workflow to repeat part of its execution until a specified condition is no longer satisfied. Instead of duplicating workflow steps, loops execute the same sequence multiple times while evaluating a predicate after each iteration. Loops are useful for iterative processing, polling operations, and retry-like business logic.What is a Loop?
A loop repeatedly executes a section of a workflow. Conceptually:Why Use Loops?
Many business processes require repeated execution. Examples include:- processing collections
- polling external services
- waiting for a condition
- batch operations
- iterative validation
Loop Flow
A loop creates a cycle within the workflow.Loop Predicate
Like condition nodes, loop nodes evaluate a predicate. Conceptually:Using Workflow Variables
Loop predicates typically evaluate workflow variables. Example:Example
Suppose a workflow processes items in a collection.Polling Example
Loops can also monitor external systems.Loops vs Retry
Although they appear similar, loops and retries solve different problems.
Retries automatically recover from failures.
Loops intentionally repeat workflow logic.
Nested Loops
Large workflows may contain multiple loops.Loop Exit
Every loop must eventually terminate.Preventing Infinite Loops
A good loop should always modify the state that controls its predicate. Example:Workflow Context
Each iteration shares the same workflow context.Common Use Cases
Loop nodes are useful for:- processing batches
- iterating over records
- pagination
- scheduled polling
- incremental processing
- approval retries
- repeated validation
Best Practices
- Ensure every loop has a clear exit condition.
- Update workflow variables during each iteration.
- Keep loop bodies focused on one task.
- Avoid deeply nested loops.
- Consider retries instead of loops for transient failures.
- Monitor long-running loops in production workflows.
